<!DOCTYPE html>
<html lang="查看学生详细信息">
<head>
    <meta charset="UTF-8">
    <title>学生详细信息查看</title>
    <link rel="stylesheet" href="../../css/main.css" media="all">
    <link rel="stylesheet" href="../../css/admin.css" media="all">
    <link rel="stylesheet" href="../../css/enterpriseauth.css" media="all">
    <link rel="shortcut icon" href="../../image/favicon.ico" type="image/x-icon"/>
    <link href="../../css/time/css/base.css" rel="stylesheet">
    <link href="../../css/time/css/index.css" rel="stylesheet">
    <link rel="stylesheet" href="../../css/ok/oksub.css">
    <script type="text/javascript" src="../../libs/loading/okLoading.js"></script>
</head>

<body style="background-color: #ffffff;">
<div class="layui-row layui-col-space10">
    <div class="layui-col-xs8 layui-col-sm8 layui-col-md8">
        <!--个人信息-->
        <div class="layui-card" style="margin-top:20px">
            <div class="layui-card-header">
                <h2>
                    <strong>个人信息</strong>
                </h2>
            </div>
            <div class="layui-card-body" id="infocontent">
                <form class="layui-form" lay-filter="stuinfo">
                    <div class="layui-form-item">
                        <img id="stuimg" src="../../imgs/tx001.jpg" width="250" height="250" class="layui-circle">
                    </div>
                    <hr>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">姓名</label>
                            <div class="layui-input-block">
                                <input type="text" name="realname" style="border: 0px;font-size: 16px"
                                       class="layui-input" disabled="disabled">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">学号</label>
                            <div class="layui-input-block">
                                <input type="text" name="stuid" style="border: 0px;font-size: 16px" class="layui-input"
                                       disabled="disabled">
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">身份证号码</label>
                            <div class="layui-input-block">
                                <input type="text" name="idnumber" style="border: 0px;font-size: 16px"
                                       class="layui-input"
                                       disabled="disabled">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">联系电话</label>
                            <div class="layui-input-block">
                                <input type="text" name="phonenumber" style="border: 0px;font-size: 16px"
                                       class="layui-input"
                                       disabled="disabled">
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">出生日期</label>
                            <div class="layui-input-block">
                                <input type="text" name="dateofbirth" style="border: 0px;font-size: 16px"
                                       class="layui-input" disabled="disabled">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">性别</label>
                            <div class="layui-input-block">
                                <input type="text" name="sex" style="border: 0px;font-size: 16px"
                                       class="layui-input" disabled="disabled">
                            </div>
                            <!--                            <div class="layui-input-inline" disabled="disabled">-->
                            <!--                                <input type="radio" name="sex" value="男" title="男" checked="">-->
                            <!--                                <input type="radio" name="sex" value="女" title="女">-->
                            <!--                            </div>-->
                        </div>
                    </div>
                    <hr>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">邮箱</label>
                            <div class="layui-input-block">
                                <input type="text" name="email" style="border: 0px;font-size: 16px" class="layui-input"
                                       disabled="disabled">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">学历</label>
                            <div class="layui-input-inline">
                                <input type="text" name="education" style="border: 0px;font-size: 16px"
                                       class="layui-input"
                                       disabled="disabled">
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">居住地址</label>
                            <div class="layui-input-block">
                                <input type="text" name="address" disabled="disabled"
                                       style="border: 0px;font-size: 16px" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">毕业年份</label>
                            <div class="layui-input-block">
                                <input type="text" name="graduation" class="layui-input"
                                       style="border: 0px;font-size: 16px" disabled="disabled">
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="layui-form-item">
                        <label class="layui-form-label">婚姻状况</label>
                        <div class="layui-input-inline">
                            <input type="text" name="marriagestatus" class="layui-input"
                                   style="border: 0px;font-size: 16px" disabled="disabled">
                        </div>
                    </div>
                    <hr>
                </form>
            </div>
        </div>

        <!--就业意向-->
        <div class="layui-card" style="margin-top:20px">
            <div class="layui-card-header">
                <h2>
                    <strong>就业意向</strong>
                </h2>
            </div>
            <div class="layui-card-body">
                <form class="layui-form" action="" lay-filter="component-form-group">
                    <div class="layui-row" style="padding-right: 50px" id="data_employmentIntentions">

                    </div>
                </form>
            </div>
        </div>
        <!--亲属关系-->
        <div class="layui-card" style="margin-top:5px">
            <div class="layui-card-header">
                <h2>
                    <strong>家庭成员</strong>
                </h2>
            </div>
            <div class="layui-card-body" id="checkfamily">
                <table id="familyMember" lay-filter="test1"></table>
            </div>
        </div>

        <!--专业课成绩-->
        <div class="layui-card" style="margin-top:20px">
            <div class="layui-card-header">
                <h2>
                    <strong>专业课成绩</strong>
                </h2>
            </div>
            <div class="layui-card-body">
                <div class="layui-form ok-search">
                    <select name="semester">
                        <option value="选择学期" disabled>选择学期</option>
                        <option value="大一上学期">大一上学期</option>
                        <option value="大一下学期">大一下学期</option>
                        <option value="大二上学期">大二上学期</option>
                        <option value="大二下学期">大二下学期</option>
                        <option value="大三上学期">大三上学期</option>
                        <option value="大三下学期">大三下学期</option>
                        <option value="大四上学期">大四上学期</option>
                        <option value="大四下学期">大四下学期</option>
                    </select>
                    <button class="layui-btn" id="search">
                        <i class="layui-icon layui-icon-search"></i>
                    </button>
                </div>
                <br>
                <!--数据表格-->
                <table id="studentAchievement" lay-filter="test"></table>
            </div>
        </div>

        <!--校内经历-->
        <div class="layui-card" style="margin-top:20px">
            <div class="layui-card-header">
                <h2>
                    <strong>校内经历</strong>
                </h2>
            </div>
            <div class="layui-card-body">
                <article class="timemain">
                    <div class="container">
                        <ul class="cbp_tmtimeline" id="data_campusExperience">
                            <li>
                                <time class="cbp_tmtime"><span>08-08</span> <span>2017</span></time>
                                <div class="cbp_tmicon"></div>
                                <div class="cbp_tmlabel" data-scroll-reveal="enter right over 1s">
                                    <h2>三步实现滚动条触动css动画效果</h2>
                                    <p><span class="blogpic"><a href="/"><img src="../../image/time/images/t03.jpg"></a></span>现在很多网站都有这种效果，我就整理了一下，分享出来。利用滚动条来实现动画效果，ScrollReveal.js
                                        用于创建和管理元素进入可视区域时的动画效果，帮助你的网站增加吸引力...</p>
                                    <a href="/" target="_blank" class="readmore">阅读全文&gt;&gt;</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </article>
            </div>
        </div>
    </div>
</div>
</body>
<script src="../../libs/layui/layui.js"></script>
<script src="../../js/scrollReveal.js"></script>
<!--就业意向数据模板-->
<script id="tpl_employmentIntentions" type="text/html">
    {{#  layui.each(d.list, function(index, item){ }}
    <div class="layui-col-md1">&nbsp;</div>
    <!--左边栏-->
    <div class="layui-col-xs6 layui-col-sm6 layui-col-md5">
        <div class="layui-form-item">
            <label class="layui-form-label">求职状态</label>
            <div class="layui-col-md7">
                <input type="text" value="{{ item.candidatestatus }}" class="layui-input" disabled="disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">期望行业</label>
            <div class="layui-col-md7">
                <input type="text" value="{{ item.jobtype }}" class="layui-input" disabled="disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">工作经验</label>
            <div class="layui-col-md7">
                <input type="text" value="{{ item.workingexperience }}" class="layui-input" disabled="disabled">
            </div>
        </div>
    </div>
    <!--右边栏-->
    <div class="layui-col-xs6 layui-col-sm6 layui-col-md5 layui-col-md-offset1">
        <div class="layui-form-item">
            <label class="layui-form-label">期望薪资</label>
            <div class="layui-col-md7">
                <input type="text" value="{{ item.salaryexpectation }}" class="layui-input" disabled="disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">学历要求</label>
            <div class="layui-col-md7">
                <input type="text" value="{{ item.educationrequirements }}" class="layui-input" disabled="disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">工作地点</label>
            <div class="layui-col-md7">
                <input type="text" value="{{ item.province }}--{{ item.city }}--{{ item.county }}" autocomplete="off"
                       class="layui-input" disabled="disabled">
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="width:95%;height: 200px;margin-left: 8.2%">
        <div class="layui-inline" style="width: 100%;height: 100%">
            <label class="layui-form-label">自我评价</label>
            <div class="layui-col-md10" style="border: 1px solid #e3e0e0;padding: 10px">
                {{ item.selfevaluation }}
            </div>
        </div>
    </div>
    {{#  }); }}

    {{#  if(d.list.length === 0){ }}
    <div class="layui-form-item" style="width:95%;height: 200px;margin-left: 8.2%">
        暂无就业意向数据
    </div>
    {{#  } }}
</script>
<!-- 校内经历模板 -->
<script id="tpl_SchoolExperience" type="text/html">
    {{#  layui.each(d.list, function(index,item){ }}
    <li>
        <time class="cbp_tmtime">
            <span>{{ (item.eventtime).substring(5,7) }}-{{ (item.eventtime).substring(8,10) }}</span> <span>{{ (item.eventtime).substring(0,4) }}</span>
        </time>
        <div class="cbp_tmicon"></div>
        <div class="cbp_tmlabel"
             data-scroll-reveal="enter right over 1s">
            <h2>校内经历</h2>
            <p><span class="blogpic"><img src="{{item.eventenclosure}}"></span>{{item.eventcontent}}
            </p>
        </div>
    </li>
    {{#  }); }}
    {{#  if(d.list.length === 0){ }}
    <li>
        <time class="cbp_tmtime">
            <span>05-20</span> <span>2020</span>
        </time>
        <div class="cbp_tmicon"></div>
        <div class="cbp_tmlabel"
             data-scroll-reveal="enter right over 1s">
            <h2>无校内经历数据</h2>
        </div>
    </li>
    {{#  } }}
</script>
<script>
    if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) {
        (function () {
            window.scrollReveal = new scrollReveal({reset: true});
        })();
    }
</script>
<script>
    let stuid = window.location.href.split("?")[1].split("=")[1];

    layui.use(['layer', 'form', 'table', 'jquery', 'laytpl'], function () {
        let layer = layui.layer;
        let form = layui.form;
        let table = layui.table;
        let laytpl = layui.laytpl;
        let $ = layui.jquery;

        // 获取contentText
        const ctx = function () {
            let pathName = document.location.pathname;
            let index = pathName.substr(1).indexOf("/");
            let result = pathName.substr(0, index + 1);
            return result;
        }();

        var achievemetTable;


        bindingPersonalInformation();

        // 绑定个人信息数据
        function bindingPersonalInformation() {
            $.ajax({
                url: ctx + '/ygssecs/getstudentbyid',
                type: 'get',
                dataType: 'json',
                data: {stuid: stuid}
            }).done(function (res) {
                okLoading.close()
                renderEmploymentIntentionData();
                var studata = res.data;
                binddata(studata);
            }).fail(function (e) {
                console.error(e)
            })
        }

        //渲染表单数据
        function binddata(studata) {
            $("#stuimg").attr("src", studata.photo)
            form.val('stuinfo', studata);
        }

        //渲染就业意向数据
        function renderEmploymentIntentionData() {
            // 得到模版html
            var gettpl = document.getElementById('tpl_employmentIntentions').innerHTML;
            //定义数据，到时候换成服务器json数据
            $.ajax({
                url: ctx + "/ygssecs/getintentionbystuid",
                type: 'GET',
                data: {stuid: stuid},
            }).done(function (res) {
                renderFamilyMembers();
                var data1;
                if (res.code == 200) {
                    let workplace = res.data.workplace;
                    var strs = workplace.split(",");
                    data1 = {
                        "list": [{
                            "candidatestatus": res.data.candidatestatus,
                            "salaryexpectation": res.data.salaryexpectation,
                            "city": strs[2],
                            "county": strs[1],
                            "province": strs[0],
                            "jobtype": res.data.jobtype,
                            "educationrequirements": res.data.educationrequirements,
                            "workingexperience": res.data.workingexperience,
                            "selfevaluation": res.data.selfevaluation
                        }]
                    };
                } else {
                    data1 = {"list": []}
                }
                //开始渲染
                laytpl(gettpl).render(data1, function (html) {
                    document.getElementById('data_employmentIntentions').innerHTML = html;
                });
            }).fail(function (e) {
                console.error(e)
            })
        }

        //渲染家庭成员
        function renderFamilyMembers() {
            //亲属关系数据渲染
            table.render({
                elem: '#familyMember'
                , width: 1007
                , url: ctx + "/ygssecs/getfamilymemberBystuid" //数据接口
                , where: {stuid: stuid}//student.stuid
                , page: false
                , response: {
                    statusName: 'code' //规定数据状态的字段名称，默认：code
                    , statusCode: 200 //规定成功的状态码，默认：0
                    , msgName: 'msg' //规定状态信息的字段名称，默认：msg
                    , countName: 'count' //规定数据总数的字段名称，默认：count
                    , dataName: 'data' //规定数据列表的字段名称，默认：data
                }
                , cols: [[ //表头
                    {field: '', title: '序号', type: 'numbers', width: 80, sort: false, fixed: 'left', align: 'center'}
                    , {field: 'name', title: '姓名', width: 150, sort: false, fixed: 'left', align: 'center'}
                    , {field: 'relation', title: '亲属关系', width: 120, align: 'center'}
                    , {field: 'phonenumber', title: '联系电话', width: 150, align: 'center'}
                    , {field: 'address', title: '居住地址', width: 250, align: 'center'}
                    , {field: 'occupation', title: '工作单位', width: 250, align: 'center'}
                ]], done: function () {
                    renderachievement();
                }
            });
        }

        // 渲染成绩
        function renderachievement() {
            //数据渲染
            achievemetTable = table.render({
                elem: '#studentAchievement'
                , width: 665
                , url: ctx + '/ygssecs/getAchievementsbysemester' //数据接口
                , where: {semester: "大一上学期", stuid: stuid}
                , page: false //开启分页
                , response: {
                    statusCode: 200 //规定成功的状态码，默认：0
                }
                , cols: [[ //表头
                    {field: '', title: '序号', type: 'numbers', width: 80, sort: false, fixed: 'left', align: 'center'}
                    , {field: 'achieveid', title: 'id', width: 180, sort: false, hide: true, align: 'center'}
                    , {field: 'semester', title: '学期', width: 180, sort: false, fixed: 'left', align: 'center'}
                    , {field: 'subject', title: '科目', width: 300, align: 'center'}
                    , {field: 'score', title: '评分', width: 100, sort: true, align: 'center'}
                ]], done: function () {
                    renderSchoolExperience();
                }
            });
            $("#search").click(function () {
                let semester = $("[name='semester']").val();
                achievemetTable.reload({
                    where: {semester: semester, stuid: stuid}
                });
            })
        }

        //渲染校内经历
        function renderSchoolExperience() {
            var tplSchoolExperience = document.getElementById("tpl_SchoolExperience").innerHTML;
            $.ajax({
                url: ctx + "/ygssecs/getstuevent",
                type: 'get',
                dataType: 'JSON',
                data: {stuid: stuid},
            }).done(function (res) {
                if (res.code == 200) {
                    var eventdatas = res.data;
                    laytpl(tplSchoolExperience).render(eventdatas, function (html) {
                        document.getElementById("data_campusExperience").innerHTML = html;
                    });
                } else {
                    layer.msg(res.msg, {icon: 0, time: 3000})
                }
            }).fail(function (error) {
                console.error(error)
            })
        }
    });
</script>
</html>